# state_machine.py

class StateMachine:
    def __init__(self):
        self.state = None

    def transition(self, new_state):
        if new_state in self.valid_states():
            self.state = new_state
            print(f"Transitioned to {self.state}")
        else:
            print(f"Invalid state transition to {new_state}")

    def valid_states(self):
        return ["idle", "running", "paused", "stopped"]

    def current_state(self):
        return self.state if self.state else "No state set"

if __name__ == "__main__":
    sm = StateMachine()
    print(sm.current_state())  # Output: No state set
    sm.transition("running")    # Output: Transitioned to running
    print(sm.current_state())   # Output: running
    sm.transition("paused")      # Output: Transitioned to paused
    sm.transition("invalid")     # Output: Invalid state transition to invalid